import book.BookList;
import operation.IOperation;
import user.Administrator;
import user.NormalUser;
import user.User;

import javax.sound.midi.SysexMessage;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-05-19
 * Time: 19:23
 */
public class Main {
    public static User login(){
        System.out.println("请输入您的姓名：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        int choice;
        System.out.println("请输入您的身份 1-管理员 2-普通用户");
        choice = scan.nextInt();
        if(choice == 1){
            return new Administrator(name);
        }
        else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        User user = login();
        BookList bookList = new BookList();
        while(true){
            int choice = user.menu();
            user.doOperations(choice,bookList);
        }
    }
}
